package com.wsc.strategy;

import java.util.Comparator;

/**
 * 体重比较策略
 */
public class WeightCompare implements Comparator<Cat> {

    /**
     * 体重轻的在后面
     * @param o1
     * @param o2
     * @return
     */
    @Override
    public int compare(Cat o1, Cat o2) {
        if (o1.getWeight() < o2.getWeight()) return 1;
        else if (o1.getAge() > o2.getAge()) return -1;
        else return 0;
    }
}
